home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / contrib / pdcurs22 / samples / tui.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-26  |  2.8 KB  |  94 lines

  1. /*
  2. ***************************************************************************
  3. * This file comprises part of PDCurses. PDCurses is Public Domain software.
  4. * You may use this code for whatever purposes you desire. This software
  5. * is provided AS IS with NO WARRANTY whatsoever.
  6. * Should this software be used in another application, an acknowledgement
  7. * that PDCurses code is used would be appreciated, but is not mandatory.
  8. *
  9. * Any changes which you make to this software which may improve or enhance
  10. * it, should be forwarded to the current maintainer for the benefit of 
  11. * other users.
  12. *
  13. * The only restriction placed on this code is that no distribution of
  14. * modified PDCurses code be made under the PDCurses name, by anyone
  15. * other than the current maintainer.
  16. * See the file maintain.er for details of the current maintainer.
  17. ***************************************************************************
  18. */
  19. /*
  20.  * File   : tui.h      'textual user interface'
  21.  * Author : P.J. Kunst  (kunst@prl.philips.nl)
  22.  * Date   : 25-02-93
  23.  * Version: 1.02
  24.  */
  25.  
  26. #ifndef _TUI_H_
  27. #define _TUI_H_
  28.  
  29. #include <curses.h>
  30.  
  31. #ifndef getbegyx
  32. #define getbegyx(w,y,x)        ( y = (w)->_begy, x = (w)->_begx )
  33. #endif
  34. #ifndef getmaxyx
  35. #define getmaxyx(w,y,x)        ( y = (w)->_maxy, x = (w)->_maxx )
  36. #endif
  37.  
  38. #ifdef A_COLOR
  39. #define A_ATTR  (A_ATTRIBUTES ^ A_COLOR)  /* A_BLINK, A_REVERSE, A_BOLD */
  40. #else
  41. #define A_ATTR  (A_ATTRIBUTES)            /* standard UNIX attributes */
  42. #endif
  43.  
  44.  
  45. #define MAXSTRLEN  256
  46. #define KEY_ESC    0x1b     /* Escape */
  47.  
  48. typedef void (*FUNC)(void);
  49.  
  50. typedef struct 
  51. {
  52.   char *name;   /* item label */
  53.   FUNC  func;   /* (pointer to) function */
  54.   char *desc;   /* function description */
  55. } menu;
  56.  
  57. /* ANSI C function prototypes: */
  58.  
  59. void    clsbody    (void);
  60. int     bodylen    (void);
  61. WINDOW *bodywin    (void);
  62.  
  63. void    rmerror    (void);
  64. void    rmstatus   (void);
  65.  
  66. void    titlemsg   (char *msg);
  67. void    bodymsg    (char *msg);
  68. void    errormsg   (char *msg);
  69. void    statusmsg  (char *msg);
  70.  
  71. bool    keypressed (void);
  72. int     getkey     (void);
  73. void    flushkeys  (void);
  74. int     waitforkey (void);
  75.  
  76. void    DoExit     (void);
  77. void    startmenu  (menu *mp, char *title);
  78. void    domenu     (menu *mp);
  79.  
  80. int     weditstr   (WINDOW *win, char *buf, int field);
  81. WINDOW *winputbox  (WINDOW *win, int nlines, int ncols);
  82. int     getstrings (char *desc[], char *buf[], int field);
  83.  
  84. #define editstr(s,f)           (weditstr(stdscr,s,f))
  85. #define mveditstr(y,x,s,f)     (move(y,x)==ERR?ERR:editstr(s,f))
  86. #define mvweditstr(w,y,x,s,f)  (wmove(w,y,x)==ERR?ERR:weditstr(w,s,f))
  87.  
  88. #define inputbox(l,c)          (winputbox(stdscr,l,c))
  89. #define mvinputbox(y,x,l,c)    (move(y,x)==ERR?w:inputbox(l,c))
  90. #define mvwinputbox(w,y,x,l,c) (wmove(w,y,x)==ERR?w:winputbox(w,l,c))
  91.  
  92. #endif
  93.